#include <QGuiApplication>
#include <QQuickView>
#include <QQmlContext>
#include <QQmlEngine>
#include <QObject>

#include <QQmlComponent>
#include <QtQml>
#include <QQmlEngine>

//#include "./src/ConvertTableModel.h"
#include "./src/Platform.h"
//#include "./src/SortFilterProxyModel.h"
int main(int argc, char *argv[])
{

#if defined(Q_OS_WIN32)
    QTextCodec* gbk = QTextCodec::codecForName("GB2312");
#elif defined(Q_OS_LINUX)
    QTextCodec* gbk = QTextCodec::codecForName("GBK");
#endif

    QTextCodec::setCodecForLocale(gbk);

    QGuiApplication app(argc, argv);
    //qmlRegisterType<ConvertTableModel>("ConvertData", 1, 0, "ConvertTableModel");
    qmlRegisterUncreatableType<Platform>("ConvertData",1,0,"Platform","Platform is only available via attached properties");
    //qmlRegisterType<SortFilterProxyModel>("ConvertData", 1, 0, "SortFilterProxyModel");

    QQuickView *view = new QQuickView;
    QObject::connect(view->engine(), SIGNAL(quit()), qApp, SLOT(quit()));
    view->setFlags(Qt::FramelessWindowHint);
    view->setResizeMode(QQuickView::SizeRootObjectToView);
    view->setSource(QUrl(QStringLiteral("qrc:/qml/main.qml")));
    view->rootContext()->setContextProperty("mainwindow",view);
    //view->rootContext()->setContextProperty("platform",Platform::getInstance());
    view->show();

    return app.exec();
}

